package org.simple.learning.spring.boot;

import org.simple.learning.spring.boot.service.adapter.FoodAdapter;
import org.simple.learning.spring.boot.service.adapter.FoodAdapters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 项目名称：spring-boot-learning
 * 类名称：MyApplication
 * 类描述：MyApplication
 * 创建时间：2020/4/10
 *
 * @author sisyphus   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
@SpringBootApplication
public class MyApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }

    @Autowired
    private FoodAdapters foodAdapters;

    @Override
    public void run(String... args) throws Exception {
        {
            FoodAdapter service = foodAdapters.getService(1L);
            String name = service.getName();
            System.out.println(name);
        }
        {
            FoodAdapter service = foodAdapters.getService(2L);
            String name = service.getName();
            System.out.println(name);
        }
    }

}
